package club.justwill.single.persistence.jpo;

import club.justwill.single.persistence.support.HistoryJpo;
import club.justwill.single.persistence.support.UserAliasesBase;
import club.justwill.single.persistence.support.UserBase;
import org.hibernate.annotations.GeneratorType;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by luoyu on 15-12-24.
 */
@Entity
@Table(name = "user_aliases_history")
public class UserAliasesHistory extends UserAliasesBase implements HistoryJpo<UserAliases> {

    @Column(name = "change_sequence")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long changeSequence;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "type")
    private Integer type;

    public Long getChangeSequence() {
        return changeSequence;
    }

    public void setChangeSequence(Long changeSequence) {
        this.changeSequence = changeSequence;
    }

    @Override
    public void copy(UserAliases obj) {
        super.copyBase(obj);
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        if(userId == null) {
            this.userId = 0L;
        } else {
            this.userId = userId;
        }
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }
}
